/**
*bts
*/ 

var	BTSDS;
var BTSFormPanel;
function doPowerBoxDelete(id)
{
	Ext.MessageBox.confirm('确认删除', '确认删除该信息?', 
	function(btn) {
		if(btn == 'yes') // 选中了是按钮	
		{
			JBTSWeb.deleteBTS(id,function(data)
			{
				if(data)
				{ 
					Ext.Msg.alert('成功',"操作成功！"); 
					BTSDS.load({params:{start:0,limit:17,'<%=Constant.BTS_CODE%>':'<%=strbtscode%>'}});	 
					BTSFormPanel.getForm().reset();			
				}else
				{
					Ext.Msg.alert("失败","操作失败!");
				}
			})
		}
	})	
}


Ext.onReady(function(){  
	Ext.QuickTips.init();
	Ext.form.Field.prototype.msgTarget = 'side';

	var BTSType = Ext.data.Record.create([								
							   {name: 'id', type: "string"},
							   {name: 'btscode', type: "string"},
							   {name: 'btsname', type: "string"},
							   {name: 'frequency', type: "string"},
							   {name: 'manufacturer', type: "string"},
							   {name: 'maintenanceT', type: "string"},
							   {name: 'btstype',  type: 'string'},
							   {name: 'primdevicetype', type: "string"},
							   {name: 'cellNum', type: "string"},
							   {name: 'BSC', type: 'string'},
							   {name: 'isVIP', type: 'string'},
							   {name: 'cabinet',  type: 'string'},
							   {name: 'btscfg',  type: 'string'},
							   {name: 'frequencyNum',  type: 'string'},
							   {name: 'nettingtime',  type: 'date'},
							   {name: 'primdevicemodel',  type: 'string'},
							   {name: 'ele2Mnum',  type: 'string'},
							   {name: 'sbtstype',  type: 'string'},
							   {name: 'isgovandarm',  type: 'string'},
							   {name: 'ismainoroth',  type: 'string'},
							   
							   {name: 'eriZPTRU',  type: 'string'},
							   {name: 'eriZPSTRU',  type: 'string'},
							   {name: 'eriZPDTRU',  type: 'string'},
							   {name: 'eriZPOther',  type: 'string'},
							   {name: 'eriHFCDUA',  type: 'string'},
							   {name: 'eriHFCDUCP',  type: 'string'},
							   {name: 'eriHFCDUC',  type: 'string'},
							   {name: 'eriHFCDUD',  type: 'string'},
							   {name: 'eriHFCDUF9',  type: 'string'},
							   {name: 'eriHFCDUG9',  type: 'string'},
							   {name: 'eriHFOther',  type: 'string'},
							   {name: 'eriDUX21',  type: 'string'},
							   {name: 'eriDUX11',  type: 'string'},
							   {name: 'eriDUX01',  type: 'string'},
							   {name: 'eriDUXOther',  type: 'string'},
							   
							   {name: 'HWZPTRU',  type: 'string'},
							   {name: 'HWZPDRU',  type: 'string'},
							   {name: 'HWZPDTRU',  type: 'string'},
							   {name: 'HWZPOther',  type: 'string'},
							   {name: 'HWHFCDUM900',  type: 'string'},
							   {name: 'HWHFOther',  type: 'string'},
							   {name: 'HWHFOther1',  type: 'string'},
							   {name: 'HWHFOther2',  type: 'string'},
							   {name: 'HWTMU',  type: 'string'},
							   {name: 'HWTMUOther',  type: 'string'},
							   {name: 'HWPMU',  type: 'string'},
							   {name: 'HWPMUOther',  type: 'string'},
							   {name: 'HWPSU',  type: 'string'},
							   {name: 'HWPSUOther',  type: 'string'},
							   {name: 'refreshtime',  type: 'string'},
							   {name: 'memo',  type: 'string'}
						 ]); 
	var BTSCM = new Ext.grid.ColumnModel(
			[
				new Ext.grid.CheckboxSelectionModel({singleSelect: true}), 	            
				{header: "流水号", sortable: true, dataIndex: 'id',align:'left'},
				{header: "基站编号", sortable: true, dataIndex: 'btscode',align:'left'},
				{header: "基站名称",  sortable: true, dataIndex: 'btsname',align:'left'},	
				{header: "使用频段",  sortable: true, dataIndex: 'frequency',align:'left'},	 	
				{header: "厂家",  sortable: true, dataIndex: 'manufacturer',align:'left'}, 
				{header: "维护方式",  sortable: true, dataIndex: 'maintenanceT',align:'left'},	 	
				{header: "基站型号",  sortable: true, dataIndex: 'btstype',align:'left'},
				{header: "主设备类型",  sortable: true, dataIndex: 'primdevicetype',align:'left'},	 
				{header: "基站小区数量",  sortable: true, dataIndex: 'cellNum',align:'left'},	 				
				{header: "删除", dataIndex: 'id',renderer: showDelete}					
			]
		);				 
	
	function showDelete(id)
	{
		return "<input type='button' value='删除' class='x-btn button' onclick='doPowerBoxDelete(\"" + id  +   "\")'>";  
	}
	
	
	
	BTSDS = new Ext.data.Store({
				proxy: new Ext.data.DWRProxy(JBTSWeb.getBTSList, true),	
				reader: new Ext.data.ListRangeReader({
					totalProperty: 'totalSize',
					id: 'id'
				}, BTSType),
				sortInfo:{field:'id', direction:'ASC'}// 排序信息
			});

	
	var towerMountedGridDiv = Ext.get("mainTabPanelDIV");
	var BTSGrid = new Ext.grid.GridPanel({			 	
			ds: BTSDS,
			cm: BTSCM, 
			sm: new Ext.grid.RowSelectionModel({
                    singleSelect: true,
                    listeners: {
                        rowselect: function(sm, row, rec) {
                            BTSFormPanel.getForm().loadRecord(rec);
                        }
                    }
                }),
			autoWidth : true,  
			autoScroll : true,  
			autoHeight　: false,
			region : 'center',
			height: 400,
			minSize: 200,		
			frame:true,
			collapsible:false, 
			enableDragDrop:false, 		
			bbar: new Ext.PagingToolbar({
					pageSize: 17,
					store: BTSDS,
					displayInfo: true,
					displayMsg: '显示第 {0} 条到 {1} 条记录，一共 {2} 条',
					emptyMsg: "没有记录"
				})
		});


	var frequencyStore  = new Ext.data.Store({  
		        proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
		        reader:new Ext.data.DWRArrayReader(
						{},
						new Ext.data.Record.create([  
							{name: 'text', mapping:1},       
							{name: 'value',mapping:0}                   
						  ])
						)  
		    }); 
	
	var frequencyCombo = new Ext.form.ComboBox({	   
		fieldLabel: '使用频段',
		name: 'frequency',	
		width:120,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		blankText:'请选使用频段',
		emptyText:'选择使用频段',
		hiddenName:'frequency',
		triggerAction: 'all',
		allowBlank:false,
		editable:false, 
		store: frequencyStore
	});	
		
	frequencyStore.on('beforeload', function() {
			  frequencyStore.baseParams = {
					DIRECTORY_TYPE:'13'   
			  };
		});	
	frequencyStore.load({params:{DIRECTORY_TYPE:'13'}});
	
	 
	var maintenanceTStore = new Ext.data.Store({  
		        proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
		        reader:new Ext.data.DWRArrayReader(
						{},
						new Ext.data.Record.create([  
							{name: 'text', mapping:1},       
							{name: 'value',mapping:0}                   
						  ])
						)  
		    }); 
	
	var maintenanceTCombo = new Ext.form.ComboBox({	   
		fieldLabel: '维护方式',
		name: 'maintenanceT',	
		width:120,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		blankText:'请选维护方式',
		emptyText:'选择维护方式',
		hiddenName:'maintenanceT',
		triggerAction: 'all',
		allowBlank:false,
		editable:false, 
		store: maintenanceTStore
	});	
	maintenanceTStore.on('beforeload', function() {
			  maintenanceTStore.baseParams = {
					DIRECTORY_TYPE:'17'   
			  };
		});	
	maintenanceTStore.load({params:{DIRECTORY_TYPE:'17'}});
	
	 
		
	var primdevicetypeTStore = new Ext.data.Store({  
		        proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
		        reader:new Ext.data.DWRArrayReader(
						{},
						new Ext.data.Record.create([  
							{name: 'text', mapping:1},       
							{name: 'value',mapping:0}                   
						  ])
						)  
		    }); 
	
	var primdevicetypeTCombo = new Ext.form.ComboBox({	   
		fieldLabel: '主设备类型',
		name: 'primdevicetype',	
		width:120,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		blankText:'请选主设备类型',
		emptyText:'选择主设备类型',
		hiddenName:'primdevicetype',
		triggerAction: 'all',
		allowBlank:false,
		editable:false, 
		store: primdevicetypeTStore
	});	
	
	primdevicetypeTStore.on('beforeload', function() {
			  primdevicetypeTStore.baseParams = {
					DIRECTORY_TYPE:'21'   
			  };
		});	
	primdevicetypeTStore.load({params:{DIRECTORY_TYPE:'21'}});	
	
	
	var btstypeStore = new Ext.data.Store({  
		        proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
		        reader:new Ext.data.DWRArrayReader(
						{},
						new Ext.data.Record.create([  
							{name: 'text', mapping:1},       
							{name: 'value',mapping:0}                   
						  ])
						)  
		    }); 
	
	var btstypeCombo = new Ext.form.ComboBox({	   
		fieldLabel: '基站型号',
		name: 'btstype',	
		width:120,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		blankText:'请选基站型号',
		emptyText:'选择基站型号',
		hiddenName:'btstype',
		triggerAction: 'all',
		allowBlank:false,
		editable:false, 
		store: btstypeStore
	});	
	
	btstypeStore.on('beforeload', function() {
			  btstypeStore.baseParams = {
					DIRECTORY_TYPE:'18'   
			  };
		});	
	btstypeStore.load({params:{DIRECTORY_TYPE:'18'}});
	
	
	var primdevicemodelStore = new Ext.data.Store({  
		        proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
		        reader:new Ext.data.DWRArrayReader(
						{},
						new Ext.data.Record.create([  
							{name: 'text', mapping:1},       
							{name: 'value',mapping:0}                   
						  ])
						)  
		    }); 
	
	var primdevicemodelCombo = new Ext.form.ComboBox({	   
		fieldLabel: '主设备型号 ',
		name: 'primdevicemodel',	
		width:120,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		blankText:'请选主设备型号 ',
		emptyText:'选择主设备型号 ',
		hiddenName:'primdevicemodel',
		triggerAction: 'all',
		allowBlank:false,
		editable:false, 
		store: primdevicemodelStore
	});	
	
	primdevicemodelStore.on('beforeload', function() {
			  primdevicemodelStore.baseParams = {
					DIRECTORY_TYPE:'21'   
			  };
		});	
	primdevicemodelStore.load({params:{DIRECTORY_TYPE:'21'}});
	
	
	
	
	var isVIPStore = new Ext.data.Store({  
		        proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
		        reader:new Ext.data.DWRArrayReader(
						{},
						new Ext.data.Record.create([  
							{name: 'text', mapping:1},       
							{name: 'value',mapping:0}                   
						  ])
						)  
		    }); 
	
	var isVIPCombo = new Ext.form.ComboBox({	   
		fieldLabel: '是否VIP基站',
		name: 'isVIP',	
		width:120,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		blankText:'请选是否VIP基站',
		emptyText:'选择是否VIP基站',
		hiddenName:'isVIP',
		triggerAction: 'all',
		allowBlank:false,
		editable:false, 
		store: isVIPStore
	});	
	
	isVIPStore.on('beforeload', function() {
			  isVIPStore.baseParams = {
					DIRECTORY_TYPE:'06'   
			  };
		});	
	isVIPStore.load({params:{DIRECTORY_TYPE:'06'}});
	
	
	var isgovandarmCombo = new Ext.form.ComboBox({	   
		fieldLabel: '是否覆盖党政军',
		name: 'isgovandarm',	
		width:120,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		blankText:'请选是否覆盖党政军',
		emptyText:'选择是否覆盖党政军',
		hiddenName:'isgovandarm',
		triggerAction: 'all', 
		editable:false, 
		store: isVIPStore
	});
	
	var ismainorothCombo = new Ext.form.ComboBox({	   
		fieldLabel: '主业/村通',
		name: 'ismainoroth',	
		width:120,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		blankText:'请选主业/村通',
		emptyText:'选择主业/村通',
		hiddenName:'ismainoroth',
		triggerAction: 'all', 
		editable:false, 
		store: isVIPStore
	});
	
	
	var sbtstypeStore = new Ext.data.Store({  
		        proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
		        reader:new Ext.data.DWRArrayReader(
						{},
						new Ext.data.Record.create([  
							{name: 'text', mapping:1},       
							{name: 'value',mapping:0}                   
						  ])
						)  
		    }); 
	var sbtstypeCombo = new Ext.form.ComboBox({	   
		fieldLabel: '基站类型',
		name: 'sbtstype',	
		width:120,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		blankText:'请选基站类型',
		emptyText:'选择基站类型',
		hiddenName:'sbtstype',
		triggerAction: 'all', 
		editable:false, 
		store: sbtstypeStore
	});
	sbtstypeStore.on('beforeload', function() {
			  sbtstypeStore.baseParams = {
					DIRECTORY_TYPE:'25'   
			  };
		});	
	//sbtstypeStore.load({params:{DIRECTORY_TYPE:'25'}});
	
		
	// Setup the form panel
	BTSFormPanel = new Ext.form.FormPanel({
		region     : 'south', 
		bodyStyle  : 'padding: 10px; background-color: #DFE8F6',  
		height: 350,
		minSize: 350,
		maxSize: 400,
		frame:true, 	
		buttonAlign:'right',
		layout:'column', 
		items:[
			{
				layout:'column', 
				items:[
					 {
						columnWidth:.25,
						layout: 'form',  
						labelWidth:70,	
						labelAlign:'right',		
						items: [
							{
								xtype:'hidden',
								fieldLabel: '流水号',
								width:120,
								name: 'id'
							},{
								xtype:'textfield',
								readOnly: true,
								fieldLabel: '基站编号', 
								width:120,
								name: 'btscode'
							},{
								xtype:'textfield',
								readOnly: true,
								fieldLabel: '基站名称',
								width:120,
								name: 'btsname'
							},{
								xtype:'numberfield',
								fieldLabel: '机柜数量',
								width:120,
								name: 'cabinet', 
								value:-1,
								allowBlank:false,
								blankText :'请输入机柜数量'	
							},
							primdevicetypeTCombo,
							ismainorothCombo
							]
					 },
					 {
						columnWidth:.25,
						layout: 'form',  
						labelWidth:100,	 
						labelAlign:'right',	
						items: [
							frequencyCombo,
							btstypeCombo, 
							{
								xtype:'textfield',
								fieldLabel: '基站配置',
								width:120,
								allowBlank:false,
								blankText :'请输入基站配置',	
								name: 'btscfg'
							}, 
							primdevicemodelCombo
							,
							sbtstypeCombo
							]
					},
					{
						columnWidth:.25,
						layout: 'form',  
						labelWidth:70,	 
						labelAlign:'right',	
						items: [
							{
								xtype:'textfield',
								fieldLabel: '厂家', 
								width:120,
								allowBlank:false,
								name: 'manufacturer'
							}, {
								xtype:'textfield',
								fieldLabel: '所属BSC',
								width:120,
								name: 'BSC'
							}, {
								xtype:'numberfield',
								fieldLabel: '载频数量',
								width:120,
								value:-1,
								name: 'frequencyNum'
							}, {
								xtype:'textfield',
								fieldLabel: '更换主设备及扩容情况',
								width:120,
								name: 'primdevicehis'
							}, {
								xtype:'textfield',
								fieldLabel: '基站小区数量',
								width:120,
								value:-1,
								name: 'cellNum'
							}]
					},
					{
						columnWidth:.25,
						layout: 'form',  
						labelWidth:100,	 
						labelAlign:'right',	
						items: [
							maintenanceTCombo, 
							isVIPCombo, 
							{
								xtype:'datefield',
								fieldLabel: '入网时间',
								format:'Y-m-d', 
								width:120,
								name: 'nettingtime',
								allowBlank:false,
								blankText :'请选择入网时间'	
							}, 
							{
								xtype:'textfield',
								fieldLabel: '使用2M电路数量',
								width:120,
								maxLength:24, 
								value:-1,
								name: 'ele2Mnum'
							},
							isgovandarmCombo
							]
					}
				]
			},
			{
				xtype:'tabpanel',
				plain:true,
				activeTab: 0,
				height:180, 
				//autoHeight:true,
				autoScroll:true,
				deferredRender: false,
				defaults:{bodyStyle:'padding:10px'},
				items:[
					{
						title:'爱立信板件数据',
						frame:true,
						autoHeight:true,
						layout:'column', 
						items:[
							 {
								columnWidth:.33,
								layout: 'form',  
								labelWidth:70,	
								height:180, 
								labelAlign:'right',			
								items: [
									{
										xtype:'fieldset',
										title: '载频型号数据',
										collapsible: true,
										autoHeight:true, 
										autoScroll:true,
										defaultType: 'textfield',
										items :[{
													xtype:'numberfield',
													fieldLabel: 'TRU数量',
													name: 'eriZPTRU',
													value:-1,
													width:120
												},{
													xtype:'numberfield',
													fieldLabel: 'STRU数量',
													name: 'eriZPSTRU',
													value:-1,
													width:120
												},{
													fieldLabel: 'DTRU数量',
													xtype:'numberfield',
													name: 'eriZPDTRU',
													value:-1,
													width:120
												},{
													fieldLabel: '其它型号',
													name: 'eriZPOther',
													value:-1,
													width:120
												}]
									}]
							 },{
								columnWidth:.02 
							 },
							 {
								columnWidth:.32,
								layout: 'form',  
								labelWidth:80,	
								labelAlign:'right',			
								items: [
									{
										xtype:'fieldset',
										title: '合分路器数据',
										collapsible: true,
										autoHeight:true, 
										defaultType: 'textfield',
										items :[{
													fieldLabel: 'CDU-A数量',
													xtype:'numberfield',
													name: 'eriHFCDUA',
													value:-1,
													width:120
												},{
													fieldLabel: 'CDU-C+数量',
													xtype:'numberfield',
													name: 'eriHFCDUCP',
													value:-1,
													width:120
												},{
													fieldLabel: 'CDU-C数量',
													xtype:'numberfield',
													name: 'eriHFCDUC',
													value:-1,
													width:120
												},{
													fieldLabel: 'CDU-D数量',
													xtype:'numberfield',
													name: 'eriHFCDUD',
													value:-1,
													width:120
												},{
													fieldLabel: 'CDU-F9数量',
													xtype:'numberfield',
													name: 'eriHFCDUF9',
													value:-1,
													width:120
												},{
													fieldLabel: 'CDU-G9数量',
													xtype:'numberfield',
													name: 'eriHFCDUG9',
													value:-1,
													width:120
												},{
													fieldLabel: '其它型号数量',
													xtype:'numberfield',
													name: 'eriHFOther',
													value:-1,
													width:120
												}]
									}]
							 },{
								columnWidth:.02 
							 },
							 {
								columnWidth:.30,
								layout: 'form',  
								labelWidth:90,	
								labelAlign:'right',			
								items: [
									{
										xtype:'fieldset',
										title: 'DXU数据',
										collapsible: true,
										autoHeight:true, 
										autoScroll:true,
										defaultType: 'textfield',
										items :[{
													fieldLabel: 'DUX-21数量',
													xtype:'numberfield',
													name: 'eriDUX21',
													value:-1,
													width:120
												},{
													fieldLabel: 'DUX-11数量',
													xtype:'numberfield',
													name: 'eriDUX11',
													value:-1,
													width:120
												},{
													fieldLabel: 'DUX-01数量',
													xtype:'numberfield',
													name: 'eriDUX01',
													value:-1,
													width:120
												},{
													fieldLabel: '其它型号数量',
													xtype:'numberfield',
													name: 'eriDUXOther',
													value:-1,
													width:120
												}]
									}]
							 }
						]
					},{
						title:'华为板件数据',
						frame:true,
						autoHeight:true,
						layout:'column', 
						items:[
							 {
								columnWidth:.19,
								layout: 'form',  
								labelWidth:70,	
								labelAlign:'right',	
								height:180, 								
								items: [
									{
										xtype:'fieldset',
										title: '载频型号数据',
										collapsible: true,
										autoHeight:true, 
										autoScroll:true,
										defaultType: 'textfield',
										items :[{
													fieldLabel: 'TRU数量',
													xtype:'numberfield',
													name: 'HWZPTRU',
													value:-1,
													width:50
												},{
													fieldLabel: 'DRU数量',
													xtype:'numberfield',
													name: 'HWZPDRU',
													value:-1,
													width:50
												},{
													fieldLabel: 'DTRU数量',
													xtype:'numberfield',
													name: 'HWZPDTRU',
													value:-1,
													width:50
												},{
													fieldLabel: '其它型号',
													name: 'HWZPOther',
													value:-1,
													width:50
												}]
									}]
							 },{
								columnWidth:.01 
							 },
							 {
								columnWidth:.19,
								layout: 'form', 
								labelAlign:'right',									
								labelWidth:90,	 
								items: [
									{
										xtype:'fieldset',
										title: '合分路器数据',
										collapsible: true,
										autoHeight:true, 
										defaultType: 'textfield',
										items :[{
													fieldLabel: 'CDU-M900数量',
													xtype:'numberfield',
													name: 'HWHFCDUM900',
													value:-1,
													width:50
												},{
													fieldLabel: '暂未定',
													xtype:'numberfield',
													name: 'HWHFOther',
													value:-1,
													width:50
												},{
													fieldLabel: '暂未定',
													xtype:'numberfield',
													name: 'HWHFOther1',
													value:-1,
													width:50
												},{
													fieldLabel: '暂未定',
													xtype:'numberfield',
													name: 'HWHFOther2',
													value:-1,
													width:50
												}]
									}]
							 },{
								columnWidth:.01
							 },
							 {
								columnWidth:.19,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:90,	 
								items: [
									{
										xtype:'fieldset',
										title: '传输管理单元数据',
										collapsible: true,
										autoHeight:true, 
										autoScroll:true,
										defaultType: 'textfield',
										items :[{
													fieldLabel: 'TMU数量',
													xtype:'numberfield',
													name: 'HWTMU',
													value:-1,
													width:50
												},{
													fieldLabel: '暂未定',
													xtype:'numberfield',
													name: 'HWTMUOther',
													value:-1,
													width:50
												}]
									}]
							 },{
								columnWidth:.01 
							 },
							 {
								columnWidth:.19,
								layout: 'form',  
								labelAlign:'right',		
								labelWidth:90,	 
								items: [
									{
										xtype:'fieldset',
										title: '电源监控单元数据',
										collapsible: true,
										autoHeight:true, 
										autoScroll:true,
										defaultType: 'textfield',
										items :[{
													fieldLabel: 'PMU数量',
													xtype:'numberfield',
													name: 'HWPMU',
													value:-1,
													width:50
												},{
													fieldLabel: '暂未定',
													xtype:'numberfield',
													name: 'HWPMUOther',
													value:-1,
													width:50
												}]
									}]
							 },{
								columnWidth:.01 
							 },
							 {
								columnWidth:.19,
								layout: 'form',  
								labelWidth:90,	
								labelAlign:'right',									
								items: [
									{
										xtype:'fieldset',
										title: '供电单元数据',
										collapsible: true,
										autoHeight:true, 
										autoScroll:true,
										defaultType: 'textfield',
										items :[{
													fieldLabel: 'PSU数量',
													xtype:'numberfield',
													name: 'HWPSU',
													value:-1,
													width:50
												},{
													fieldLabel: '暂未定',
													xtype:'numberfield',
													name: 'HWPSUOther',
													value:-1,
													width:50
												}]
									}]
							 }
						]
					},{
						title:'备注',
						frame:true,
						//autoHeight:true,
						items:[
							{
								xtype:'textarea',
								fieldLabel: '备注',
								width:800,
								name: 'memo'
							}
						]
					}
					]
			}	 
			],
		buttons :[
			{
				text : ' 保存',
				handler : saveBTS
			},{
				text : ' 取消',
				handler : function(){
					BTSFormPanel.getForm().reset(); 
					BTSFormPanel.getForm().loadRecord(recordForAll);	
				}
			}
			]	
	});



	//Simple 'border layout' panel to house both grids
	
	var displayPanel = new Ext.Panel({
		width    : towerMountedGridDiv.getComputedWidth(),
		height   : 500,
		layout   : 'border',
		renderTo : 'BTSTab',
		items    : [
			BTSGrid,
			BTSFormPanel
		]
	});
	
	
	function saveBTS()
	{
		if (!BTSFormPanel.getForm().isValid())
			return;	
			
		var form = BTSFormPanel.getForm().getValues(false);	
		BTSBO = {};
		BTSBO.id = form.id;
		BTSBO.btscode = form.btscode;
		BTSBO.btsname = form.btsname;
		BTSBO.frequency = form.frequency;
		BTSBO.manufacturer = form.manufacturer;
		BTSBO.maintenanceT = form.maintenanceT;
		BTSBO.btstype = form.btstype;
		BTSBO.primdevicetype = form.primdevicetype;
		BTSBO.cellNum = form.cellNum;
		BTSBO.BSC = form.BSC;
		BTSBO.isVIP = form.isVIP;
		BTSBO.cabinet = form.cabinet;
		BTSBO.btscfg = form.btscfg;
		BTSBO.frequencyNum = form.frequencyNum;
		
		var nettingtimeDate = new Date();	
		var arrPlanTime = form.nettingtime.split("-");		
				
		var yearOth = arrPlanTime[0];
		var monthOth = arrPlanTime[1];
		var dayOth = arrPlanTime[2];
		nettingtimeDate.setFullYear(yearOth,monthOth-1,dayOth);
		
		BTSBO.nettingtime = nettingtimeDate;
		BTSBO.primdevicemodel = form.primdevicemodel;
		BTSBO.ele2Mnum = form.ele2Mnum;
		BTSBO.primdevicehis = form.primdevicehis;
		BTSBO.sbtstype = form.sbtstype;
		BTSBO.isgovandarm = form.isgovandarm;
		BTSBO.ismainoroth = form.ismainoroth;
		
		
		BTSBO.eriZPTRU = form.eriZPTRU;
		BTSBO.eriZPSTRU = form.eriZPSTRU;
		BTSBO.eriZPDTRU = form.eriZPDTRU;
		BTSBO.eriZPOther = form.eriZPOther;
		BTSBO.eriHFCDUA = form.eriHFCDUA;
		BTSBO.eriHFCDUCP = form.eriHFCDUCP;
		BTSBO.eriHFCDUC = form.eriHFCDUC;
		BTSBO.eriHFCDUD = form.eriHFCDUD;
		BTSBO.eriHFCDUF9 = form.eriHFCDUF9;
		BTSBO.eriHFCDUG9 = form.eriHFCDUG9;
		BTSBO.eriHFOther = form.eriHFOther;
		
		BTSBO.eriDUX21 = form.eriDUX21;
		BTSBO.eriDUX11 = form.eriDUX11;
		BTSBO.eriDUX01 = form.eriDUX01;
		BTSBO.eriDUXOther = form.eriDUXOther;
		
		BTSBO.HWZPTRU = form.HWZPTRU;
		BTSBO.HWZPDRU = form.HWZPDRU;
		BTSBO.HWZPDTRU = form.HWZPDTRU;
		BTSBO.HWZPOther = form.HWZPOther;
		BTSBO.HWHFCDUM900 = form.HWHFCDUM900;
		BTSBO.HWHFOther = form.HWHFOther;
		BTSBO.HWHFOther1 = form.HWHFOther1;
		BTSBO.HWHFOther2 = form.HWHFOther2;
		BTSBO.HWTMU = form.HWTMU;
		BTSBO.HWTMUOther = form.HWTMUOther;
		BTSBO.HWPMU = form.HWPMU;
		BTSBO.HWPMUOther = form.HWPMUOther;
		BTSBO.HWPSU = form.HWPSU;
		BTSBO.HWPSUOther = form.HWPSUOther;
		BTSBO.memo = form.memo;
		 
		JBTSWeb.saveBTS(BTSBO,function(data)
		{
			if(data)
			{ 
				Ext.Msg.alert('成功',"操作成功！"); 
				loadDate(BTSDS,BTSFormPanel);	 
			}else
			{
				Ext.Msg.alert("失败","操作失败!");
			}
		})
			
	}
	
	loadDate(BTSDS,BTSFormPanel);	
	
})

		



